Skip to content

关闭日志系统 - LogShutdown

函数简介

关闭日志系统并释放资源。

接口名称

LogShutdown

DLL调用

c
int32_t LogShutdown(int64_t instance, int64_t loggerHandle);

参数说明

参数名类型说明
instance长整数型OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。
loggerHandle长整数型日志实例句柄(0 表示默认实例)

示例

SDK 调用

cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
int ret = ola.LogShutdown(0);
csharp
using OLAPlug;

var ola = new OLAPlugServer();
int ret = ola.LogShutdown(0);
python
from OLAPlugServer import OLAPlugServer

ola = OLAPlugServer()
ret = ola.LogShutdown(0)
java
import com.olaplug.OLAPlugServer;

OLAPlugServer ola = new OLAPlugServer();
int ret = ola.LogShutdown(0);
cpp
var ola = com("OlaPlug.OlaSoft")
var ret = ola.LogShutdown(0)
vbscript
Set ola = CreateObject("OlaPlug.OlaSoft")
ret = ola.LogShutdown(0)
text
.局部变量 ola, OLAPlug
ola.创建 ()
ret = ola.LogShutdown(0)
aardio
import OLAPlugServer;
var ola = OLAPlugServer();
var ret = ola.LogShutdown(0);
text
变量 ola <类型 = OLAPlugServer>
ola = 新建 OLAPlugServer
整数 ret = ola.LogShutdown(0)
cpp
#include "OLAPlugServer.h"

OLAPlugServer ola;
int32_t ret = ola.LogShutdown(0);

原生 DLL 调用

cpp
LogShutdown(instance, 0);
csharp
using System.Runtime.InteropServices;
using System.Text;

[DllImport("OLAPlug_x64.dll", CallingConvention = CallingConvention.StdCall)]
static extern int LogShutdown(long ola, int loggerHandle);

LogShutdown(instance, 0);
python
from ctypes import CDLL, c_int, c_int64, create_string_buffer

ola = CDLL("OLAPlug_x64.dll")
ola.CreateCOLAPlugInterFace.restype = c_int64
ola.LogShutdown(instance, 0)

返回值

1 成功,0 失败。

注意事项

  • 关闭后,下次写入日志时会自动重新初始化
  • 关闭前会自动刷新所有缓冲区中的日志
  • 关闭后会释放所有相关资源(文件句柄、内存等)
  • 不建议频繁调用,会影响性能